home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / DDJ0192.ARJ / DFLAT.DOC < prev    next >
Text File  |  1991-10-10  |  48KB  |  1,256 lines

  1. Window Classes:
  2.  
  3. Window classes define the behavior of windows. Each class has its own
  4. unique reaction to messages. Classes derive from other classes.
  5.  
  6.     NORMAL       base window for all window classes
  7.     APPLICATION  application window. has the menu 
  8.                  (derived from NORMAL)
  9.     TEXTBOX      textbox. base window for listbox, editbox, etc.
  10.                  (derived from NORMAL)
  11.     LISTBOX      listbox. base window for menubar
  12.                  (derived from TEXTBOX)
  13.     PICTUREBOX   picturebox. a text box onto which you can draw lines
  14.                  (derived from TEXTBOX)
  15.     EDITBOX      editbox
  16.                  (derived from TEXTBOX)
  17.     MENUBAR      the application's menu bar
  18.                  (derived from NORMAL)
  19.     POPDOWNMENU  popdown menu
  20.                  (derived from LISTBOX)
  21.     BUTTON       command button in a dialog box
  22.                  (derived from TEXTBOX)
  23.     SPINBUTTON   spin button in a dialog box
  24.                  (derived from LISTBOX)
  25.     COMBOBOX     combination editbox/listbox
  26.          (derived from EDITBOX)
  27.     DIALOG       dialog box. parent to editbox, button, listbox, etc.
  28.                  (derived from NORMAL)
  29.     ERRORBOX     for displaying an error message
  30.                  (derived from DIALOG)
  31.     MESSAGEBOX   for displaying a message
  32.                  (derived from DIALOG)
  33.     HELPBOX      help window
  34.                  (derived from DIALOG)
  35.     TEXT         static text on a dialog box
  36.                  (derived from TEXTBOX)
  37.     RADIOBUTTON  radio button on a dialog box
  38.                  (derived from TEXTBOX)
  39.     CHECKBOX     check box on a dialog box
  40.                  (derived from TEXTBOX)
  41.     STATUSBAR    status bar at the bottom of application window
  42.                  (derived from TEXTBOX)
  43.  
  44.                D-Flat Window Class Tree
  45.     ┌─────────────────────────────────────────────┐
  46.     │                                             │
  47.     │      NORMAL                                 │
  48.     │        │                                    │
  49.     │        ├── APPLICATION                      │
  50.     │        │                                    │
  51.     │        ├── MENUBAR                          │
  52.     │        │                                    │
  53.     │        ├── TEXTBOX                          │
  54.     │        │      │                             │
  55.     │        │      ├── LISTBOX                   │
  56.     │        │      │      │                      │
  57.     │        │      │      ├──── POPDOWNMENU      │
  58.     │        │      │      │                      │
  59.     │        │      │      └──── SPINBUTTON       │
  60.     │        │      │                             │
  61.     │        │      ├── EDITBOX                   │
  62.     │        │      │      │                      │
  63.     │        │      │      └──── COMBOBOX         │
  64.     │        │      │                             │
  65.     │        │      ├── PICTUREBOX                │
  66.     │        │      │                             │
  67.     │        │      ├── STATUSBAR                 │
  68.     │        │      │                             │
  69.     │        │      ├── TEXT                      │
  70.     │        │      │                             │
  71.     │        │      ├── BUTTON                    │
  72.     │        │      │                             │
  73.     │        │      ├── RADIOBUTTON               │
  74.     │        │      │                             │
  75.     │        │      └── CHECKBOX                  │
  76.     │        │                                    │
  77.     │        └── DIALOG                           │
  78.     │              │                              │
  79.     │              ├── ERRORBOX                   │
  80.     │              │                              │
  81.     │              ├── MESSAGEBOX                 │
  82.     │              │                              │
  83.     │              └── HELPBOX                    │
  84.     │                                             │
  85.     └─────────────────────────────────────────────┘
  86.  
  87.  
  88. Window Attributes:
  89.  
  90. Every window has an attribute word that defines some of its
  91. appearance and behavior. The following values are bitwise flags that
  92. OR together to make a window's attributes.
  93.  
  94. You can establish default attributes for a window's class, add
  95. additional attributes when you create the window, and use the
  96. AddAttribute, ClearAttribute, and TestAttribute macros to change and
  97. test a window's attributes.
  98.  
  99.     SHADOW       has a shadow
  100.     MOVEABLE     can move the window with mouse or cursor
  101.     SIZEABLE     can resize the window with mouse or cursor
  102.     HASMENUBAR   has a menubar (an application window)
  103.     VSCROLLBAR   has a vertical scroll bar
  104.     HSCROLLBAR   has a horizontal scroll bar
  105.     VISIBLE      is visible
  106.     SAVESELF     saves its own video memory
  107.     TITLEBAR     has a title bar 
  108.     CONTROLBOX   has a control box and control menu
  109.     MINMAXBOX    has a min/max box 
  110.     NOCLIP       is not clipped to its parent's borders
  111.     READONLY     is a readonly textbox
  112.     MULTILINE    is a multiline editbox or listbox
  113.     HASBORDER    has a border
  114.     HASSTATUSBAR has a statusbar (application window only)
  115.  
  116. Messages:
  117.  
  118. A D-Flat program is message-driven. You initiate message processing
  119. with the init_messages function, create a window with the
  120. CreateWindow function, and go into the message dispatching loop with
  121. the dispatch_message function. 
  122.  
  123. A window can have a window-processing function. When the user causes
  124. events to occur by pressing keys and using the mouse, D-Flat sends
  125. messages to the window's function. That function can send messages to
  126. itself and other windows with the SendMessage and PostMessage
  127. functions.
  128.  
  129. Windows are declared as members of a class. Every class has a default
  130. window-processing function. If you do not provide one for an instance
  131. of a window class, the default one receives messages for the window.
  132. Your custom window-processing function--if one exists--should chain to
  133. the default window-processing function for the blass by calling the
  134. DefaultWndProc function.
  135.  
  136. There are five things a window-processing function can do with a
  137. message:
  138.   - ignore it and let the D-Flat default processing occur.
  139.   - suppress it by returning without chaining to the default
  140.     window-processing function for the window class.
  141.   - chain to the default window-processing function and then do some
  142.     additional processing.
  143.   - do some preliminary processing and then chain to the default
  144.     window-processing function.
  145.   - do all the processing of the message and then return without 
  146.     chaining to the default window-processing function for the 
  147.     window class.
  148.  
  149. Following are the messages that an application program would use.
  150. There are other messages, but they are used by D-Flat only.
  151.  
  152. Process Communication Messages  
  153.  
  154. START                  start message processing (not used now)
  155.   Sent:    
  156.   P1:      
  157.   P2:      
  158.   Returns: 
  159.  
  160. STOP                   stop message processing        
  161.   Sent:    by application window to NULLWND to stop message 
  162.            dispatch loop
  163.   P1:      
  164.   P2:      
  165.   Returns: 
  166.  
  167. COMMAND                send a command to a window
  168.   Sent:    to send command
  169.   P1:      command code (commands.h)
  170.   P2:      additional data (command-dependent)
  171.            If the command code is a menu selection, P2 is the
  172.            position of the selection on the menu (1,2,...)
  173.            If the command code is a dialog box control, P2 is
  174.            ENTERFOCUS when the command gets the focus, LEAVEFOCUS
  175.            when the command loses the focus, and 0 when the user
  176.            executes the control's command, e.g. presses a button.
  177.   Returns: Nothing if sent by PostCommand
  178.            Command-dependent value if sent by SendCommand
  179.  
  180.  
  181. Window Management Messages  
  182.  
  183. CREATE_WINDOW          create a window                
  184.   Sent:    by DFLAT to new window after window is created
  185.   P1:      
  186.   P2:      
  187.   Returns: 
  188.  
  189. SHOW_WINDOW            show a window                  
  190.   Sent:    by the app to the window to display the window
  191.   P1:      
  192.   P2:      
  193.   Returns: 
  194.  
  195. HIDE_WINDOW            hide a window                  
  196.   Sent:    by the app to the window to hide the window
  197.   P1:      
  198.   P2:      
  199.   Returns: 
  200.  
  201. CLOSE_WINDOW           delete a window                
  202.   Sent:    by the app to destroy a window
  203.   P1:      
  204.   P2:      
  205.   Returns: 
  206.  
  207. SETFOCUS               set and clear the focus        
  208.   Sent:    by D-Flat or the app to set or release the focus
  209.   P1:      true = set, false = release
  210.   P2:      
  211.   Returns: 
  212.  
  213. PAINT                  paint the window's data space  
  214.   Sent:    to paint the client area of a window
  215.   P1:      address of RECT relative to window (0/0 = upper left) 
  216.            to paint or 0 to paint entire client area
  217.   P2:      
  218.   Returns: 
  219.  
  220. BORDER                 paint the window's border      
  221.   Sent:    to paint a window's border
  222.   P1:      address of RECT relative to window (0/0 = upper left) 
  223.            to paint or 0 to paint entire border
  224.   P2:      
  225.   Returns: FALSE to suppress D-Flat title display 
  226.            (e.g. the window displays its own border)
  227.  
  228. TITLE                  display the window's title     
  229.   Sent:    by D-Flat when it is about to display a window's title
  230.   P1:      address of RECT relative to window (0/0 = upper left) 
  231.            to paint or 0 to paint entire title
  232.   P2:      
  233.   Returns: FALSE to suppress D-Flat title display 
  234.            (e.g. the window displays its own title)
  235.  
  236. MOVE                   move the window                
  237.   Sent:    to move a window
  238.   P1:      new left coordinate
  239.   P2:      new upper coordinate
  240.   Returns: 
  241.  
  242. SIZE                   change the window's size       
  243.   Sent:    to resize a window
  244.   P1:      new right coordinate
  245.   P2:      new lower coordinate
  246.   Returns: 
  247.  
  248. MAXIMIZE               maximize the window            
  249.   Sent:    to maximize a window within its parent's client area
  250.   P1:      
  251.   P2:      
  252.   Returns: 
  253.  
  254. MINIMIZE               minimize the window            
  255.   Sent:    to minimize a window to an icon 
  256.   P1:      
  257.   P2:      
  258.   Returns: 
  259.  
  260. RESTORE                restore the window             
  261.   Sent:    to restore a window to its position and size prior to the
  262.            maximize or minimize operation
  263.   P1:      
  264.   P2:      
  265.   Returns: 
  266.  
  267. INSIDE_WINDOW          test x/y inside a window       
  268.   Sent:    to test to see if coordinates are inside a window
  269.   P1:      x
  270.   P2:      y
  271.   Returns: true or false
  272.  
  273.  
  274. Clock Messages  
  275.  
  276. CLOCKTICK              the clock ticked               
  277.   Sent:    every second to a window that has captured the clock
  278.   P1:      segment of time display string
  279.   P2:      offset of time display string
  280.   Returns: 
  281.  
  282. CAPTURE_CLOCK          capture clock into a window    
  283.   Sent:    to capture the clock
  284.   P1:      
  285.   P2:      
  286.   Returns: 
  287.  
  288. RELEASE_CLOCK          release clock to the system    
  289.   Sent:    to release the captured clock
  290.   P1:      
  291.   P2:      
  292.   Returns: 
  293.  
  294.  
  295. Keyboard and Screen Messages  
  296.  
  297. KEYBOARD               key was pressed                
  298.   Sent:    when key is pressed. sent to the window that has the focus 
  299.   P1:      keystroke
  300.   P2:      shift key mask
  301.   Returns: 
  302.  
  303. CAPTURE_KEYBOARD       capture keyboard into a window 
  304.   Sent:    by window to itself to capture the keyboard 
  305.            regardless of focus
  306.   P1:      
  307.   P2:      
  308.   Returns: 
  309.  
  310. RELEASE_KEYBOARD       release keyboard to system     
  311.   Sent:    by window to itelf to release the captured keyboard
  312.   P1:      
  313.   P2:      
  314.   Returns: 
  315.  
  316. KEYBOARD_CURSOR        position the keyboard cursor   
  317.   Sent:    to position the keyboard cursor
  318.   P1:      x (if sent by window, 0 = left client area)
  319.   P2:      y (if sent by window, 0 = top client area)
  320.            if sent with NULLWND, x/y are relative to the screen
  321.   Returns: 
  322.  
  323. CURRENT_KEYBOARD_CURSOR    read the cursor position
  324.   Sent:    to retrieve the cursor position
  325.   P1:      x (relative to the screen)
  326.   P2:      y (relative to the screen)
  327.   Returns: 
  328.  
  329. HIDE_CURSOR            hide the keyboard cursor       
  330.   Sent:    to hide the keyboard cursor
  331.   P1:      
  332.   P2:      
  333.   Returns: 
  334.  
  335. SHOW_CURSOR            display the keyboard cursor    
  336.   Sent:    to display the keyboard cursor
  337.   P1:      
  338.   P2:      
  339.   Returns: 
  340.  
  341. SAVE_CURSOR            save the cursor's configuration
  342.   Sent:    to save the keyboard cursor's current configuration 
  343.   P1:      
  344.   P2:      
  345.   Returns: 
  346.  
  347. RESTORE_CURSOR         restore the saved cursor       
  348.   Sent:    to restore a keyboard cursor's saved configuration 
  349.   P1:      
  350.   P2:      
  351.   Returns: 
  352.  
  353. SHIFT_CHANGED          the shift status changed       
  354.   Sent:    to in-focus window when the user presses or 
  355.            releases shift, alt, or ctrl key
  356.   P1:      BIOS shift key mask
  357.   P2:      
  358.   Returns: 
  359.  
  360. WAITKEYBOARD            wait for key release
  361.   Sent:    to wait for a keypress release
  362.   P1:
  363.   P2:      
  364.   Returns: 
  365.  
  366.  
  367. Mouse Messages  
  368.  
  369. RESET_MOUSE            reset the mouse
  370.   Sent:    to reset the mouse to the current screen configuration
  371.   P1:
  372.   P2:      
  373.   Returns: 
  374.  
  375. MOUSE_TRAVEL        set the mouse's travel
  376.   Sent:    to limit the mouse travel to a screen rectangle
  377.   P1:      address of a RECT
  378.   P2:      
  379.   Returns: 
  380.  
  381. MOUSE_INSTALLED        test for mouse installed       
  382.   Sent:    to see if the mouse is installed
  383.   P1:      
  384.   P2:      
  385.   Returns: true or false
  386.  
  387. RIGHT_BUTTON           right button pressed           
  388.   Sent:    to window when the user presses the right button
  389.            (sent only when mouse cursor is within the window
  390.             or the window has captured the mouse)
  391.   P1:      x
  392.   P2:      y
  393.   Returns: 
  394.  
  395. LEFT_BUTTON            left button pressed            
  396.   Sent:    to window when the user presses the left button
  397.            (sent only when mouse cursor is within the window
  398.             or the window has captured the mouse)
  399.   P1:      x
  400.   P2:      y
  401.   Returns: 
  402.  
  403. DOUBLE_CLICK           left button doubleclicked    
  404.   Sent:    to window when the user double-clicks the left button
  405.            (sent only when mouse cursor is within the window
  406.             or the window has captured the mouse)
  407.            (a LEFT_BUTTON message will have preceded this one)
  408.   P1:      x
  409.   P2:      y
  410.   Returns: 
  411.  
  412. MOUSE_MOVED            mouse changed position         
  413.   Sent:    to window when the mouse has moved
  414.            (sent only when mouse cursor is within the window
  415.             or the window has captured the mouse)
  416.   P1:      x
  417.   P2:      y
  418.   Returns: 
  419.  
  420. BUTTON_RELEASED        mouse button released          
  421.   Sent:    to window when user releases mouse button
  422.            (sent only when mouse cursor is within the window
  423.             or the window has captured the mouse)
  424.   P1:      x
  425.   P2:      y
  426.   Returns: 
  427.  
  428. CURRENT_MOUSE_CURSOR   get mouse position             
  429.   Sent:    to determine the current mouse position
  430.   P1:      address of x
  431.   P2:      address of y
  432.   Returns: 
  433.  
  434. MOUSE_CURSOR           set mouse position             
  435.   Sent:    to set the current mouse position
  436.   P1:      x
  437.   P2:      y
  438.   Returns: 
  439.  
  440. SHOW_MOUSE             make mouse cursor visible      
  441.   Sent:    to display the mouse cursor
  442.   P1:      
  443.   P2:      
  444.   Returns: 
  445.  
  446. HIDE_MOUSE             hide mouse cursor              
  447.   Sent:    to hide the mouse cursor
  448.   P1:      
  449.   P2:      
  450.   Returns: 
  451.  
  452. WAITMOUSE              wait until button released     
  453.   Sent:    to wait until the user releases the mouse button
  454.   P1:      
  455.   P2:      
  456.   Returns: 
  457.  
  458. TESTMOUSE              test any mouse button pressed  
  459.   Sent:    to see if either mouse button is pressed
  460.   P1:      
  461.   P2:      
  462.   Returns: true or false
  463.  
  464. CAPTURE_MOUSE          capture mouse into a window    
  465.   Sent:    by/to a window to capture all mouse activity 
  466.            regardless of whether it occurs inside this window
  467.   P1:      
  468.   P2:      
  469.   Returns: 
  470.  
  471. RELEASE_MOUSE          release the mouse to system    
  472.   Sent:    release a captured mouse
  473.   P1:      
  474.   P2:      
  475.   Returns: 
  476.  
  477.  
  478. Text Box Messages  
  479.  
  480. ADDTEXT                add text to the text box       
  481.   Sent:    to append a line of text to the text box
  482.   P1:      address of null-terminated string 
  483.            (textbox makes its own copy. string can go out of scope.)
  484.   P2:      
  485.   Returns: 
  486.  
  487. CLEARTEXT              clear the text box             
  488.   Sent:    clear all text from the text box
  489.   P1:      
  490.   P2:      
  491.   Returns: 
  492.  
  493. SETTEXT                set address of text buffer     
  494.   Sent:    To set text buffer to caller's text.
  495.   P1:      address of text buffer
  496.            (lines are terminated by \n without \0)
  497.            (textbox makes its own copy. string can go out of scope.)
  498.   P2:      length of text buffer
  499.   Returns: 
  500.  
  501. SCROLL                 vertical scroll of text box    
  502.   Sent:    to scroll a text window vertically one line
  503.   P1:      true = scroll up, false = scroll down
  504.   P2:
  505.   Returns: 
  506.  
  507. HORIZSCROLL            horizontal scroll of text box 
  508.   Sent:    to scroll a text window horizontally one column
  509.   P1:      true = scroll left, false = scroll right
  510.   P2:
  511.   Returns: 
  512.  
  513. SCROLLPAGE             vertical scroll of text box 1 page
  514.   Sent:    to scroll a text window vertically one page
  515.   P1:      true = scroll up, false = scroll down
  516.   P2:
  517.   Returns: 
  518.  
  519. HORIZSCROLLPAGE        horizontal scroll of text box 1 page
  520.   Sent:    to scroll a text window horizontally one page
  521.   P1:      true = scroll left, false = scroll right
  522.   P2:
  523.   Returns: 
  524.  
  525. SCROLLDOC             document scroll of text box
  526.   Sent:    to scroll a text window to beginning/end of document
  527.   P1:      true = scroll to beginning, false = scroll to end
  528.   P2:
  529.   Returns: 
  530.  
  531. Edit Box Messages  
  532.  
  533. GETTEXT             get text from an edit box      
  534.   Sent:    Get the line of text from a single-line editbox
  535.   P1:      address of receiving buffer
  536.   P2:      max length to copy
  537.   Returns: 
  538.  
  539. SETTEXTLENGTH        set maximum text length in an edit box      
  540.   Sent:    to set the maximum number of characters that an editbox
  541.            may hold in its buffer.
  542.   P1:      maximum character count
  543.   P2:      
  544.   Returns: 
  545.  
  546.  
  547. Application Window Messages
  548.  
  549. ADDSTATUS               write text to the status bar
  550.   Sent:    to write to or clear status bar text area
  551.   P1:      address of text (null-terminated string) or NULL to clear
  552.   P2:      
  553.   Returns: 
  554.  
  555. List Box Messages  
  556.  
  557. LB_SELECTION               list box selection
  558.   Sent:    sent by list box to self and to parent (if parent is not
  559.            a simple LISTBOX window) when user moves to an entry on 
  560.            the list box.
  561.   P1:      selection number: 0, 1, ...
  562.   P2:      if multi-line selection listbox, shift status mask
  563.            if not, true = selection was same as choice (e.g. mouse)
  564.   Returns: 
  565.  
  566. LB_CHOOSE               list box choice        
  567.   Sent:    sent to parent of list box when user chooses an item 
  568.            from the list box
  569.   P1:      selection number: 0, 1, ...
  570.   P2:      
  571.   Returns: 
  572.  
  573. LB_CURRENTSELECTION    return the current selection   
  574.   Sent:    To get the current selection number (where the listbox
  575.            cursor is positioned)
  576.   P1:      
  577.   P2:      
  578.   Returns: selection number: 0, 1, ...
  579.  
  580. LB_GETTEXT             return the text of selection   
  581.   Sent:    To get a copy of the text at a specified line
  582.   P1:      Address of string to receive copy of text
  583.   P2:      Line number: 0, 1, ...
  584.   Returns: 
  585.  
  586. LB_SETSELECTION        sets the listbox selection     
  587.   Sent:    To change where the listbox cursor points
  588.   P1:      Line number: 0, 1, ...
  589.   P2:      
  590.   Returns: 
  591.  
  592. Picture Box Messages
  593.  
  594. DRAWVECTOR           Draws a vector
  595.   Sent:    To draw a vector in the window's client area
  596.   P1:      address of RECT that describes the vector relative to the
  597.            window's client area
  598.            (either lf = rt [vertical vector] or tp = bt [horizontal
  599.            vector])
  600.   P2:      
  601.   Returns: 
  602.  
  603. DRAWBOX             Draws a box
  604.   Sent:    To draw a box in the window's client area
  605.   P1:      address of RECT that describes the box relative to the
  606.            window's client area
  607.   P2:      
  608.   Returns: 
  609.  
  610. DRAWBAR             Draws a barchart bar
  611.   Sent:    To draw a bar in the window's client area
  612.   P1:      address of RECT that describes the bar relative to the
  613.            window's client area
  614.            (either lf = rt [vertical vector] or tp = bt [horizontal
  615.            vector])
  616.   P2:      one of these: SOLIDBAR, HEAVYBAR, CROSSBAR, LIGHTBAR
  617.              (4 different bar textures)
  618.   Returns: 
  619.  
  620. =====================================================
  621.  
  622. API Functions & Macros:
  623.  
  624. These are functions and macros defined for use by applications
  625. programs. There are many others defined in the header files. These
  626. others are for D-Flat to use, and programmers need not be concerned
  627. about them except as an expression of their curiosity about how
  628. D-Flat works.
  629.  
  630.  
  631. (Note: These specifications are not in any orderly sequence yet.)
  632.  
  633.  
  634. -------------------------------------------------------------------
  635. void init_messages(void)
  636.  
  637. Call this function first to initialize message processing
  638.  
  639. -------------------------------------------------------------------
  640. WINDOW CreateWindow(
  641.     CLASS class,              /* class of this window       */
  642.     char *ttl,                /* title or NULL              */
  643.     int left, int top,        /* upper left coordinates     */
  644.     int height, int width,    /* dimensions                 */
  645.     void *extension,          /* pointer to additional data */
  646.     WINDOW parent,            /* parent of this window      */
  647.     int (*wndproc)(struct window *,MESSAGE,PARAM,PARAM),
  648.     int attrib)               /* window attribute           */
  649.  
  650. This function creates a window. It returns the WINDOW handle that
  651. mesages and functions use to identify the window.
  652.  
  653. -------------------------------------------------------------------
  654. void PostMessage(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
  655.  
  656. Post a message to a window. The window will receive the message in
  657. turn during the message-dispatching loop.
  658.  
  659. -------------------------------------------------------------------
  660. int SendMessage(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
  661.  
  662. Send a message to a window. The window will receive the message
  663. immediately. Control returns to the sender after the window has
  664. processed the message. The window can return an integer value.
  665.  
  666. This function can send system messages to NULLWND. System messages
  667. are ones that D-Flat processes without regard to a particular window.
  668. -------------------------------------------------------------------
  669. int dispatch_message(void)
  670.  
  671. The message dispatching loop. After opening the first window (usually
  672. the applications window), continue to call this function until it
  673. returns a FALSE value.
  674. -------------------------------------------------------------------
  675. int TestCriticalError(void)
  676.  
  677. -------------------------------------------------------------------
  678. int DefaultWndProc(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
  679.  
  680. Call this from a window-processing function to chain to the default
  681. window-processing function for the window's class.
  682.  
  683. -------------------------------------------------------------------
  684. int BaseWndProc(CLASS class, WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
  685.  
  686. Call this from the window-processing function of a derived window
  687. class to chain to the window-processing function of the base window's
  688. class.
  689.  
  690. -------------------------------------------------------------------
  691. int WindowHeight(WINDOW wnd)
  692. int WindowWidth(WINDOW wnd)
  693.  
  694. These functions return the window's height and width.
  695. -------------------------------------------------------------------
  696. int ClientWidth(WINDOW wnd)
  697. int ClientHeight(WINDOW wnd)
  698.  
  699. These functions return the height and width of the window's client
  700. area.
  701.  
  702. -------------------------------------------------------------------
  703. int GetTop(WINDOW wnd)
  704. int GetBottom(WINDOW wnd)
  705. int GetLeft(WINDOW wnd)
  706. int GetRight(WINDOW wnd)
  707.  
  708. These functions return the screen coordinates of the four corners of
  709. the window.
  710.  
  711. -------------------------------------------------------------------
  712. int GetClientTop(WINDOW wnd)
  713. int GetClientBottom(WINDOW wnd)
  714. int GetClientLeft(WINDOW wnd)
  715. int GetClientRight(WINDOW wnd)
  716.  
  717. These functions return the screen coordinates of the four corners of
  718. the window's client area.
  719.  
  720. -------------------------------------------------------------------
  721. WINDOW GetParent(WINDOW wnd)
  722.  
  723. Returns the parent of the window or NULLWND if the window has no
  724. parent.
  725. -------------------------------------------------------------------
  726. WINDOW GetFirstChild(WINDOW pwnd)
  727.  
  728. Returns the first child of a parent window or NULLWND if the window
  729. has no children.
  730.  
  731. -------------------------------------------------------------------
  732. WINDOW GetNextChild(WINDOW pwnd, WINDOW cwnd)
  733.  
  734. Call this function repetitively after GetFirstChild. It returns the
  735. next child window after the one specified in the second parameter. If
  736. there are no more children, the function returns NULLWND.
  737.  
  738. -------------------------------------------------------------------
  739. WINDOW GetLastChild(WINDOW pwnd)
  740.  
  741. Returns the last child of a p`rent window or NULLWND if the window
  742. has no children.
  743.  
  744. -------------------------------------------------------------------
  745. WINDOW GetPrevChild(WINDOW pwnd, WINDOW wnd)
  746.  
  747. Call this function repetitively after GetLastChild. It returns the
  748. previous child window before the one specified in the second
  749. parameter. If there are no more children, the function returns
  750. NULLWND.
  751.  
  752. -------------------------------------------------------------------
  753. int CharInView(WINDOW wnd, int x, int y)
  754.  
  755. Returns true if the x/y character position, relative to the window,
  756. is in view (not clipped at the border of a parent window or the
  757. screen.
  758.  
  759. -------------------------------------------------------------------
  760. int TopBorderAdj(WINDOW wnd)
  761.  
  762. Returns the value to add to a y coordinate of the window's client
  763. area to make it relative to the window top.
  764.  
  765. -------------------------------------------------------------------
  766. int BorderAdj(WINDOW wnd)
  767.  
  768. Returns the value to add to an x coordinate relative to the window's
  769. client area to make it relative to the window's left edge.
  770.  
  771. -------------------------------------------------------------------
  772. char *GetTitle(WINDOW wnd)
  773.  
  774. Returns the address of a window's title, or NULL if the window has no
  775. title.
  776.  
  777. -------------------------------------------------------------------
  778. void AddTitle(WINDOW wnd, char *title)
  779.  
  780. Adds or changes the title to an existing window.
  781.  
  782. -------------------------------------------------------------------
  783. CLASS GetClass(WINDOW wnd)
  784.  
  785. Returns the class of the window.
  786.  
  787. -------------------------------------------------------------------
  788. int GetAttribute(WINDOW wnd)
  789.  
  790. Returns the attribute word of a window.
  791.  
  792. -------------------------------------------------------------------
  793. void AddAttribute(WINDOW wnd, int attrib)
  794.  
  795. Adds one or more attributes to a window. OR the attribute values
  796. together.
  797.  
  798. -------------------------------------------------------------------
  799. void ClearAttribute(WINDOW wnd, int attrib)
  800.  
  801. Clears one or more attributes from a window. OR the attribute values
  802. together.
  803.  
  804. -------------------------------------------------------------------
  805. int TestAttribute(WINDOW wnd, int attrib)
  806.  
  807. Tests one or more attributes in a window. Returns true if any of them
  808. are set. OR the attribute values together.
  809.  
  810. -------------------------------------------------------------------
  811. int isVisible(WINDOW wnd)
  812.  
  813. Returns true if the window is visible.
  814.  
  815. -------------------------------------------------------------------
  816. char *GetText(WINDOW wnd)
  817.  
  818. Returns the address of the text buffer for a TEXTBOX or derived
  819. window class.
  820.  
  821. -------------------------------------------------------------------
  822. char *TextLine(WINDOW wnd, int line)
  823.  
  824. Returns the address of a specified line of text (0, 1, ...) in a
  825. TEXTBOX or derived class.
  826.  
  827. -------------------------------------------------------------------
  828. WINDOW inWindow(int x, int y)
  829.  
  830. Returns the WINDOW handle of the window that x/y are in or NULL if
  831. x/y is outside of any window.
  832.  
  833. -------------------------------------------------------------------
  834. int isActive(MENU *mnu, int command)
  835.  
  836. Returns true if the command (commands.h) on the menu is active
  837. (enabled).
  838.  
  839. -------------------------------------------------------------------
  840. char *GetCommandText(MBAR *mn, int cmd)
  841.  
  842. Returns the address of a menu command's title text.
  843.  
  844. -------------------------------------------------------------------
  845. void ActivateCommand(MENU *mnu, int command)
  846. void DeactivateCommand(MENU *mnu, int command)
  847.  
  848. Activate (enable) or deactivate (disable) a command (commands.h) on a
  849. menu.
  850.  
  851. -------------------------------------------------------------------
  852. int GetCommandToggle(MENU *mnu, int command)
  853. void SetCommandToggle(MENU *mnu, int command)
  854. void ClearCommandToggle(MENU *mnu, int command)
  855. void InvertCommandToggle(MENU *mnu, int command)
  856.  
  857. Some menu commands are toggles rather than executors of processes. 
  858. Examples are the Insert and Word wrap commands on the Options menu.
  859. These functions get, set, clear, and invert the toggle setting for a
  860. specified command on a specified menu.
  861.  
  862. -------------------------------------------------------------------
  863. int ItemSelected(WINDOW wnd, int line)
  864.  
  865. This function returns true if the specified item (0, 1, ...) on a
  866. multiple-line selection listbox is selected.
  867.  
  868. -------------------------------------------------------------------
  869. int DialogBox(
  870.   WINDOW wnd,        /* parent window of the dialog box        */
  871.   DBOX *db,          /* address of dialog box definition array */
  872.   int Modal,         /* trus if it is a modal dialog box       */
  873.   int (*wndproc)(struct window *, MESSAGE, PARAM, PARAM)
  874.                      /* the window processing function or NULL */
  875. )
  876.  
  877. This function executes a dialog box. If it is a modal dialog box, the
  878. function does not return until the user completes the dialog box. The
  879. return value will be true if the user has selected OK and false if
  880. the user has selected Cancel on the dialog box. If the dialog box is
  881. modeless, the function returns immediately, and the user can select
  882. other things from the screen while the dialog box is still active.
  883.  
  884. -------------------------------------------------------------------
  885. WINDOW ControlWindow(DBOX *db, enum commands cmd)
  886.  
  887. This function returns the WINDOW handle of the control specified by
  888. the cmd parameter.
  889. -------------------------------------------------------------------
  890. int DlgOpenFile(char *filespec, char *filename)
  891.  
  892. This function operates the Open File dialog box. The filespec pointer
  893. points to a default file path specification that the dialog box uses
  894. to display files, for example, *.DOC. If the function returns true,
  895. the space pointed to by the filename pointer will contain the path
  896. and filename selected by the user to be read.
  897.  
  898. -------------------------------------------------------------------
  899. int DlgSaveAs(char *filename)
  900.  
  901. This function operates the Save As dialog box. If the function returns
  902. true, the space pointed to by the filename pointer will contain the
  903. path and filename selected by the user where the file will be
  904. written.
  905.  
  906. -------------------------------------------------------------------
  907. void MessageBox(char *title, char *message)
  908. void CancelBox(wnd, char *message)
  909. void ErrorMessage(char *message)
  910. int TestErrorMessage(char *message)
  911. int YesNoBox(char *question)
  912. WINDOW MomentaryMessage(char *message)
  913.  
  914. These functions display generic message boxes. The message text is
  915. one null-terminated string with newlines (\n) to indicate where lines
  916. are to be broken. The size of the boxes adjusts to the width of the
  917. longest line and the number of lines of text. A message may have no
  918. more lines of text than will fit into the largest window that the
  919. screen can display. You must account for the window's border's and
  920. the presence at the bottom of one or more command buttons.
  921.  
  922. The MessageBox function displays a message in a window with a title
  923. provided by the caller. The window contains the message and an OK
  924. command button.
  925.  
  926. The CancelBox function displays a message in a window with a
  927. "Wait..." title. The window contains the message and a Cancel command
  928. button. If the user presses the Cancel button before the program
  929. closes the window, the COMMAND, ID_CANCEL message is sent to the
  930. parent window.
  931.  
  932. The ErrorMessage function displays the message in an error box window
  933. with an OK command button.
  934.  
  935. The TestErrorMessage function is an error message with OK and Cancel
  936. command buttons. The function returns true if the user selects OK or
  937. presses Enter and false if the user selects Cancel or presses Esc.
  938.  
  939. The YesNoBox function displays the message with Yes and No command
  940. buttons. The function returns true if the user selects Yes or
  941. presses Enter and false if the user selects No or presses Esc.
  942.  
  943. The MomentaryMessage function displays a message box and returns its
  944. WINDOW handle. The caller must close the window. The purpose of this
  945. function is to allow you to display a message while some time
  946. consuming process is underway and then erase the message after the
  947. process is done but without any action required from the user.
  948.  
  949. -------------------------------------------------------------------
  950. int RadioButtonSetting(DBOX *db, enum commands cmd)
  951.  
  952. This function returns true if the specified command on the specified
  953. dialog box is a pressed radio button.
  954.  
  955. -------------------------------------------------------------------
  956. void EnableButton(DBOX *db, enum commands cmd)
  957.  
  958. This function enables a command button on a dialog box. command
  959. buttons are initially enabled when the dialog box is first opened.
  960.  
  961. -------------------------------------------------------------------
  962. void DisableButton(DBOX *db, enum commands cmd)
  963.  
  964. This function disables a command button on a dialog box. command
  965. buttons are initially enabled when the dialog box is first opened.
  966.  
  967. -------------------------------------------------------------------
  968. void PushRadioButton(DBOX *db, enum commands cmd)
  969.  
  970. This function presses the specified radio button command on the
  971. specified dialog box.
  972.  
  973. -------------------------------------------------------------------
  974. void PutItemText(WINDOW wnd, enum commands cmd, char *text)
  975.  
  976. This function appends a line of text to a TEXT, TEXTBOX, EDITBOX,
  977. LISTBOX, SPINBUTTON, or COMBOBOX control window in a dialog box. The
  978. wnd parameter is the WINDOW handle of the dialog box. The cmd
  979. parameter specifies the command associated with the control item. The
  980. text parameter points to the text to be added. The control window
  981. makes its own copy of the text, so the caller's copy can go out of
  982. scope.  If the control window is a COMBOBOX, TEXTBOX, or EDITBOX
  983. window, you must send a PAINT message to the control window so that
  984. the new text will display.
  985.  
  986. You must call this function while the dialog box is active. That
  987. means that if the dialog box is modal, you must call this function
  988. from within a custom window processing function that you supply when
  989. you call DialogBox.
  990.  
  991. -------------------------------------------------------------------
  992. void PutComboListText(WINDOW wnd, enum commands cmd, char *text)
  993.  
  994. This function appends a line of text to the LISTBOX of a COMBOBOX
  995. control window in a dialog box. The wnd parameter is the WINDOW
  996. handle of the dialog box. The cmd parameter specifies the command
  997. associated with the combo box. The text parameter points to the
  998. text to be added. The control window makes its own copy of the text,
  999. so the caller's copy can go out of scope.
  1000.  
  1001. You must call this function while the dialog box is active. That
  1002. means that if the dialog box is modal, you must call this function
  1003. from within a custom window processing function that you supply when
  1004. you call DialogBox.
  1005.  
  1006. -------------------------------------------------------------------
  1007. void GetItemText(WINDOW wnd, enum commands cmd, char *text, int length)
  1008.  
  1009. This function copies the text from a TEXT, TEXTBOX, COMBOBOX, or
  1010. EDITBOX control window in a dialog box. The wnd parameter is the
  1011. WINDOW handle of the dialog box. The cmd parameter specifies the
  1012. command associated with the control item. The text parameter points
  1013. to the caller's buffer where the text will be copied. The length
  1014. parameter specifies the maximum number of characters to copy.
  1015.  
  1016. You must call this function while the dialog box is active. That
  1017. means that if the dialog box is modal, you must call this function
  1018. from within a custom window processing function that you supply when
  1019. you call DialogBox.
  1020.  
  1021. -------------------------------------------------------------------
  1022. char *GetEditBoxText(DBOX *db, enum commands cmd)
  1023.  
  1024. This function returns a pointer to the text associated with an
  1025. editbox control in a dialog box. You can call it after the dialog box
  1026. has completed processing. The buffer is on the heap. Do not free it.
  1027. Instead, call SetEditBoxText with a NULL pointer.
  1028.  
  1029. If the text has not changed since it was initialized, this function
  1030. returns NULL.
  1031.  
  1032. -------------------------------------------------------------------
  1033. char *GetComboBoxText(DBOX *db, enum commands cmd)
  1034.  
  1035. This function returns a pointer to the text associated with an
  1036. combo box control in a dialog box. You can call it after the dialog box
  1037. has completed processing. The buffer is on the heap. Do not free it.
  1038. Instead, call SetEditBoxText with a NULL pointer.
  1039.  
  1040. If the text has not changed since it was initialized, this function
  1041. returns NULL.
  1042.  
  1043. -------------------------------------------------------------------
  1044. void SetEditBoxText(DBOX *db, enum commands cmd, char *text)
  1045.  
  1046. This function sets the text of a dialog box editbox. You can call
  1047. this function before or while the dialog box is open. The dialog box
  1048. makes it own copy on the heap, so your text can go out of scope.
  1049.  
  1050. -------------------------------------------------------------------
  1051. void SetComboBoxText(DBOX *db, enum commands cmd, char *text)
  1052.  
  1053. This function sets the text of a dialog box combo box. You can call
  1054. this function before or while the dialog box is open. The dialog box
  1055. makes it own copy on the heap, so your text can go out of scope.
  1056.  
  1057. -------------------------------------------------------------------
  1058. char *GetDlgText(DBOX *db, enum commands cmd, char *text)
  1059.  
  1060. Similar to GetEditBoxText except that it works with text controls.
  1061.  
  1062. -------------------------------------------------------------------
  1063. char *SetDlgText(DBOX *db, enum commands cmd, char *text)
  1064.  
  1065. Similar to SetEditBoxText except that it works with text controls.
  1066.  
  1067. -------------------------------------------------------------------
  1068. char *GetDlgTextBox(DBOX *db, enum commands cmd, char *text)
  1069.  
  1070. Similar to GetEditBoxText except that it works with textbox controls.
  1071.  
  1072. -------------------------------------------------------------------
  1073. char *SetDlgTextBox(DBOX *db, enum commands cmd, char *text)
  1074.  
  1075. Similar to SetEditBoxText except that it works with textbox controls.
  1076.  
  1077. -------------------------------------------------------------------
  1078. void SetCheckBox(DBOX *db, enum commands cmd)
  1079. void ClearCheckBox(DBOX *db, enum commands cmd)
  1080. int CheckBoxSetting(DBOX *db, enum commands cmd)
  1081.  
  1082. These functions set, clear, and test the setting of a specified check
  1083. box control item on a dialog box.
  1084.  
  1085. -------------------------------------------------------------------
  1086. void LoadHelpFile(char *expath);
  1087.  
  1088. This function loads the help file named by the DFLAT_APPLICATION
  1089. global constant with the .HLP file extension. The expath parameter
  1090. points to the DOS path where the file can be found.
  1091.  
  1092. Call this function at the beginning of an application program.
  1093.  
  1094. -------------------------------------------------------------------
  1095. void UnLoadHelpFile(void);
  1096.  
  1097. Call this function at the end of a D-Flat application to free the
  1098. memory used by a help file.
  1099.  
  1100. -------------------------------------------------------------------
  1101. void SearchText(WINDOW wnd)
  1102.  
  1103. Opens a dialog box for the user to enter a search string. Searches
  1104. the wnd TEXTBOX for a match on the string.
  1105.  
  1106. -------------------------------------------------------------------
  1107. void ReplaceText(WINDOW wnd)
  1108.  
  1109. Opens a dialog box for the user to enter search and replacement
  1110. strings. Searches the wnd TEXTBOX for a match on the string and
  1111. replaces it if found. The dialog box includes an option to replace
  1112. all matches.
  1113.  
  1114. -------------------------------------------------------------------
  1115. void SearchNext(WINDOW wnd)
  1116.  
  1117. Assumes that a previous SearchText call has found a match. Searches
  1118. for the next match of the same string in the specified EDITBOX
  1119. window.
  1120.  
  1121. -------------------------------------------------------------------
  1122. void WriteTextLine(WINDOW wnd, RECT *rcc, int y, int reverse)
  1123.  
  1124. This function displays a text line from a TEXTBOX or derived window
  1125. class. The text has already been added to the window with ADDTEXT,
  1126. etc. The y parameter specifies which line (0, 1, ...) relative to the
  1127. window's text buffer to display. If the specified line is not in
  1128. view, the function does nothing. If the reverse parameter is true,
  1129. the line displays in the reverse-video colors of the window. The rcc
  1130. RECT pointer is usually NULL for applications calls. It points to a
  1131. rectangle relative to the window outside of which displays will not
  1132. occur. 
  1133.  
  1134. -------------------------------------------------------------------
  1135. void PutWindowLine(WINDOW wnd, void *s, int x, int y)
  1136.  
  1137. This function writes a line of text to a window. The x and y
  1138. coordinates point to the first character in the window's client area
  1139. where the line is to be written. The text must be null-terminated.
  1140. This function clips the line if it goes beyond the window or the
  1141. screen. The function clips the line if it goes outside the borders of
  1142. the window's parent. If other windows overlap the target window, the
  1143. text is clipped. Do not use negative values in x or y.
  1144.  
  1145. You can assign color values to the global variables foreground and
  1146. background to affect the color of the line's display.
  1147.  
  1148. -------------------------------------------------------------------
  1149. void PutWindowChar(WINDOW wnd, int c, int x, int y)
  1150.  
  1151. This function writes the character c to a window. The x and y
  1152. coordinates are relative to the window's client area.
  1153.  
  1154. The function performs clipping. If the character is beyond the
  1155. window's or the screen's borders it is not written. If the window
  1156. does not have the NOCLIP attribute, the character is not written if
  1157. its coordinates are beyond the margins of its parent window (if the
  1158. window has a parent). If other windows overlap the target window, the
  1159. text is clipped. Do not use negative values in x or y.
  1160.  
  1161. You can assign color values to the global variables foreground and
  1162. background to affect the color of the character's display.
  1163.  
  1164. -------------------------------------------------------------------
  1165. void DrawVector(WINDOW wnd, int x, int y, int len, int hv)
  1166.  
  1167. Draw a horizontal vector in a picture box. x and y are character
  1168. coordinates relative to the starting position of the vector. len is
  1169. the length. hv is TRUE for a horizontal vector and FALSE for a
  1170. vertical vector. Sends a DRAWVECTOR message to the window.
  1171.  
  1172. Send a PAINT message to the window to display the vectors.
  1173.  
  1174. -------------------------------------------------------------------
  1175. void DrawBox(WINDOW wnd, int x, int y, int ht, int wd)
  1176.  
  1177. Draw a box in a picture box. x and y are character coordinates
  1178. relative to the upper left corner of the box. ht and wd are the
  1179. height and width of the box. Sends a DRAWBOX message to the window.
  1180.  
  1181. Send a PAINT message to the window to display the box.
  1182.  
  1183. -------------------------------------------------------------------
  1184. void DrawBar(WINDOW wnd, enum VectTypes vt, int x, int y, int len, int hv)
  1185.  
  1186. Draw a graph bar in a picture box. vt is one of the following values
  1187. to specify the character box used to display the bar: SOLIDBAR,
  1188. HEAVYBAR, CROSSBAR, LIGHTBAR. x and y are character coordinates
  1189. relative to the starting position of the bar. len is the length. hv
  1190. is TRUE for a horizontal bar and FALSE for a vertical bar. Sends a
  1191. DRAWBAR message to the window.
  1192.  
  1193. Send a PAINT message to the window to display the bars.
  1194.  
  1195. -------------------------------------------------------------------
  1196. void WindowClientColor(WINDOW wnd, int fg, int bg)
  1197.  
  1198. Changes the window client space's foreground and background colors.
  1199. -------------------------------------------------------------------
  1200. void WindowReverseColor(WINDOW wnd, int fg, int bg)
  1201.  
  1202. Changes the window's foreground and background reverse colors, which
  1203. are used to display such things as selected text blocks.
  1204. -------------------------------------------------------------------
  1205. void WindowFrameColor(WINDOW wnd, int fg, int bg)
  1206.  
  1207. Changes the window's foreground and background frame colors.
  1208. -------------------------------------------------------------------
  1209. void WindowHighlightColor(WINDOW wnd, int fg, int bg)
  1210.  
  1211. Changes the window's foreground and background highlight colors,
  1212. which are used to display highlighted items such as menu selector
  1213. bars.
  1214. -------------------------------------------------------------------
  1215. void MarkTextBlock(WINDOW wnd, int BegLine, int BegCol,
  1216.                                int EndLine, int EndCol)
  1217.  
  1218. Marks a block in the specified TEXTBOX window.
  1219.  
  1220. -------------------------------------------------------------------
  1221. void ClearTextBlock(WINDOW wnd)
  1222.  
  1223. Unmarks a marked block in the specified TEXTBOX window.
  1224.  
  1225. -------------------------------------------------------------------
  1226. void CopyToClipboard(WINDOW wnd)
  1227.  
  1228. Copies a marked block from the specified TEXTBOX window into the
  1229. Clipboard.
  1230.  
  1231. -------------------------------------------------------------------
  1232. void PasteFromClipboard(WINDOW wnd)
  1233.  
  1234. Pastes the Clipboard's contents into the specified EDITBOX window at
  1235. the current cursor location.
  1236.  
  1237. -------------------------------------------------------------------
  1238. Configurable Items
  1239.  
  1240. Global Symbol File      Value Description
  1241. ------------- --------- ----- ---------------------------------------
  1242. MAXMESSAGES   DFLAT.H    50   Maximum D-Flat messages queued
  1243. MAXCONTROLS   DIALBOX.H  26   Maximum Controls on a dialog box
  1244. MAXRADIOS     DIALBOX.H  20   Maximum radio buttons in a group
  1245. MAXSAVES      SYSTEM.H   50   Maximum cursor saves
  1246. MAXPULLDOWNS  MENU.H     10   Maximum number of pull-down menus on
  1247.                               a menu bar
  1248. MAXSELECTIONS MENU.H     15   Maximum number of selections on 
  1249.                               a pull-down menu (includes separators)
  1250. MAXCASCADES   MENU.H      3   Maximum nesting level of cascaded menus
  1251. MAXTEXTLEN    DFLAT.H 65000   Maximum text buffer
  1252. EDITLEN       DFLAT.H  1024   Starting length for multiline EDITBOX
  1253. ENTRYLEN      DFLAT.H   256   Starting length for single-line EDITBOX
  1254. GROWLENGTH    DFLAT.H    64   EDITBOX buffers grow by this much
  1255.  
  1256.